import {defineStore} from "pinia"

//useCountStore命名规范
export const useCountStore = defineStore('count',{
    //里面放置的是方法，用于响应组件的“动作”
    actions:{
        increment(value:number){
            console.log(this.sum)
            if(this.sum<10){
            //this是当前的store
            this.sum += value
            }
        }
    },
    //真正存储数据的地方
    state(){
        return{                  //响应式的ref数据
            sum:0,
            school:"xuexiao",
            address:"地址"
        }
    },
    getters:{
        bigSum:state => state.sum * 10 ,    //箭头函数写法
        // bigSum(state){
        //     return state.sum * 10
        // }
        toUpper():string{
            return this.school.toUpperCase()
        }
    }
})